<template>
  <div id="tradeOrderFollow">
    <NavBar title="跟随高手" />
    <div class="Box">
      <div class="contact">
        <Icon name="info" />选择跟随前请仔细阅读 <span>《跟随协议》</span>
      </div>
      <div class="title">跟随方式</div>
      <div class="follow">
        <div
          :class="active == index ? 'btn active' : 'btn'"
          v-for="(item, index) in follow"
          :key="index"
          @click="clickBtn(index)"
        >
          {{ item }}
        </div>
      </div>
      <div class="title">跟随{{ active == 0 ? '手' : '倍' }}数</div>
      <Stepper
        v-show="active == 0"
        v-model="shouNum"
        input-width="80"
        button-size="50"
        :min="0.01"
        :step="0.01"
        :decimal-length="2"
      />
      <Stepper
        v-show="active == 1"
        v-model="beiNum"
        input-width="80"
        button-size="50"
        :min="0.1"
        :step="0.1"
        :decimal-length="1"
      />
      <div class="info">
        <div class="meta">提示:</div>
        <div class="msg">
          无论交易员下单多少，您都按照选择的固定比例跟随，最少{{
            active == 0 ? '0.01' : '0.1'
          }}手
          <p v-show="active == 1">（当比例手数&lt;0.01手时取0.01，当比例手数&gt;0.01时，四舍五入保留两位小数取值）</p>
        </div>
      </div>
    </div>
    <div class="confirm" @click="confirm">确认</div>
  </div>
</template>

<script>
import NavBar from '@/components/navbar'
import { Icon, Stepper } from 'vant'

export default {
  components: {
    NavBar,
    Icon,
    Stepper
  },
  data() {
    return {
      shouNum: 0.01, //手数
      beiNum: 0.1, //倍数
      active: 0,
      follow: ['金额(手数)固定跟随', '金额(手数)比例跟随'] //  金额(手数)固定跟随'or'金额(手数)比例跟随
    }
  },
  methods: {
    clickBtn(index) {
      this.active = index
    },
    //确认
    confirm(){
      console.log(this.shouNum,this.beiNum)
    }
  }
}
</script>

<style lang="less" scoped>
#tradeOrderFollow {
  background: #f5f5f5;
  min-height: 100vh;
  .Box {
    background-color: #fff;
    padding: 16px;
    .contact {
      font-size: 13px;
      display: flex;
      align-items: center;
      .van-icon {
        margin-right: 5px;
        color: #4e82f0;
      }
      span {
        color: #2082fb;
      }
    }
    .title {
      padding: 15px 0;
      font-size: 15px;
      font-weight: 700;
    }
    .follow {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .btn {
        width: 160px;
        border: 0.5px solid #d3d3d3;
        text-align: center;
        line-height: 50px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 3px;
      }
      .active {
        background-color: #ff822e;
        color: #fff;
        border: 0.5px solid #ff822e;
      }
    }
    /deep/.van-stepper__input {
      color: rgb(0, 0, 0) !important;
      font-size: 18px !important;
    }
    .info {
      display: flex;
      margin-top: 15px;
      color: #646464;
      .meta {
        width: 50px;
      }
       p{
          margin: 0;
        }
    }
  }
  .confirm {
    width: 100%;
    line-height: 60px;
    text-align: center;
    background-color: #4e82f0;
    color: #fff;
    position: fixed;
    bottom: 0;
    font-size: 17px;
  }
}
</style>
